cd /tmp/
rm drcomver* drcominst.sh
sel=0;selt=0;cloudver=0
wget http://code.taobao.org/svn/luyou/drcomver.t
wget http://git.oschina.net/neophack/luyou/raw/master/drcomver.o
[ -f /tmp/drcomver.t ] && drcomvert=`cat /tmp/drcomver.t`
[ -f /tmp/drcomver.o ] && drcomvero=`cat /tmp/drcomver.o`
echo "$drcomvert"|[ -n "`sed -n '/^[0-9][0-9]*$/p'`" ] && selt=1
echo "$drcomvero"|[ -n "`sed -n '/^[0-9][0-9]*$/p'`" ] && selo=1
if [ "$selo" = "1" ] && [ "$selt" = "1" ] ; then
    if [ "$drcomvert" -gt "$drcomvero" ] ; then
	    cloudver=$drcomvert
	else
	    cloudver=$drcomvero
	fi
elif [ "$selo" = "1" ] ; then
    cloudver=$drcomvero
else
    cloudver=$drcomvert
    logger -t "drcom" "server are not available!"
fi
[ -f /etc/drcomver ] || echo 010 >/etc/drcomver
[ -f /etc/drcomver ] && curver=`cat /etc/drcomver` 
echo $drcomvert+$drcomvero+$curver+$cloudver
if [ "$cloudver" -gt "$curver" ]; then 
    echo upgrade$selt
	if [ "$selt" = "1" ] ; then
            wget http://code.taobao.org/svn/luyou/drcominst.sh
	else
	    wget http://git.oschina.net/neophack/luyou/raw/master/drcominst.sh
	fi
    chmod 777 drcominst.sh
    ./drcominst.sh
    logger -t "drcom" "updated:$curver+$cloudver"
else
    logger -t "drcom" "latest:$curver+$cloudver"
fi
